Ext.namespace("Nippy.Components.NodeEditors");

Nippy.Components.NodeEditors.Page2 = Ext.extend(Nippy.Components.NodeEditors.BasicEditor, {
	initComponent: function(){
        var i = [{
		            fieldLabel: 'Заголовок',
		            name: 'Header',
		            allowBlank: true
		        },{
		            fieldLabel: 'Текст',
                    height: 400,
		            xtype: 'htmleditor',
		            name: 'Text',
		            allowBlank: true,
                    plugins: [new Ext.ux.form.HtmlEditor.Uploader()]
		        }]; 
        if (this.addOther){this.items=i.concat(this.items); }
        else{
            Ext.apply(this, {
                labelWidth: 135,
                frame:true,
                title: 'Товар ('.concat(this.nodeId,')'),
                bodyStyle:'padding:5px 5px 0',
                width: 550,
                defaultType: 'textfield',
                addOther: true,
                items: i
            });
        }
		Nippy.Components.NodeEditors.Page2.superclass.initComponent.apply(this, arguments);
	}
	,saveClick: function(){
		this.getForm().submit({
			url: '/admin/cfg-page2/',
			method: 'PUT',
			scope: this,
			params: {id: this.nodeId},
			failure: this.submitFailure,
			success: function(form, action){
				this.fireEvent('onsaved', this);
			}
		});
	}
});